/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pe.gov.mtc.dgac.licencias.bean;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author externo.gamaro
 */
@Entity
@Table(name = "MENU")
@NamedQueries({})
public class Menu implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = "MENUID", nullable = false)
    private Integer menuid;
    @Column(name = "TIPO", nullable = false)
    private String tipo;
    @Column(name = "DESCRIPCION", nullable = false)
    private String descripcion;
    @Column(name = "ESTADO", nullable = false)
    private String estado;
    @Column(name = "POSID", nullable = false)
    private int posid;
    @Column(name = "TITULO", nullable = false)
    private String titulo;
    @Column(name = "URL", nullable = false)
    private String url;
    @Column(name = "USUARIO_CREA", nullable = false)
    private String usuarioCrea;
    @Column(name = "USUARIO_MOD")
    private String usuarioMod;
    @Column(name = "FEC_CREA", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecCrea;
    @Column(name = "FEC_MOD")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecMod;
    @OneToMany(mappedBy = "menuidparent")
    private Collection<Menu> menuCollection;
    @JoinColumn(name = "MENUIDPARENT", referencedColumnName = "MENUID")
    @ManyToOne
    private Menu menuidparent;

    public Menu() {
    }

    public Menu(Integer menuid) {
        this.menuid = menuid;
    }

    public Menu(Integer menuid, String tipo, String descripcion, String estado, int posid, String titulo, String url, String usuarioCrea, Date fecCrea) {
        this.menuid = menuid;
        this.tipo = tipo;
        this.descripcion = descripcion;
        this.estado = estado;
        this.posid = posid;
        this.titulo = titulo;
        this.url = url;
        this.usuarioCrea = usuarioCrea;
        this.fecCrea = fecCrea;
    }

    public Integer getMenuid() {
        return menuid;
    }

    public void setMenuid(Integer menuid) {
        this.menuid = menuid;
    }

    public String getTipo() {
        return tipo;
    }

    public void setTipo(String tipo) {
        this.tipo = tipo;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public String getEstado() {
        return estado;
    }

    public void setEstado(String estado) {
        this.estado = estado;
    }

    public int getPosid() {
        return posid;
    }

    public void setPosid(int posid) {
        this.posid = posid;
    }

    public String getTitulo() {
        return titulo;
    }

    public void setTitulo(String titulo) {
        this.titulo = titulo;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getUsuarioCrea() {
        return usuarioCrea;
    }

    public void setUsuarioCrea(String usuarioCrea) {
        this.usuarioCrea = usuarioCrea;
    }

    public String getUsuarioMod() {
        return usuarioMod;
    }

    public void setUsuarioMod(String usuarioMod) {
        this.usuarioMod = usuarioMod;
    }

    public Date getFecCrea() {
        return fecCrea;
    }

    public void setFecCrea(Date fecCrea) {
        this.fecCrea = fecCrea;
    }

    public Date getFecMod() {
        return fecMod;
    }

    public void setFecMod(Date fecMod) {
        this.fecMod = fecMod;
    }

    public Collection<Menu> getMenuCollection() {
        return menuCollection;
    }

    public void setMenuCollection(Collection<Menu> menuCollection) {
        this.menuCollection = menuCollection;
    }

    public Menu getMenuidparent() {
        return menuidparent;
    }

    public void setMenuidparent(Menu menuidparent) {
        this.menuidparent = menuidparent;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (menuid != null ? menuid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Menu)) {
            return false;
        }
        Menu other = (Menu) object;
        if ((this.menuid == null && other.menuid != null) || (this.menuid != null && !this.menuid.equals(other.menuid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.gov.mtc.dgac.licencias.bean.Menu[menuid=" + menuid + "]";
    }

}
